﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SGV.Win32
{
    public partial class frmPrincipal : Form
    {
        public frmPrincipal()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CargarFondoPantalla();
            //IniciarControles();


        }


        private void CargarFondoPantalla()
        {
            Size desktop = new Size();
            desktop = System.Windows.Forms.SystemInformation.PrimaryMonitorSize;
            int alto = desktop.Height;
            int ancho = desktop.Width;
            if (ancho == 1280)
            {
                this.BackgroundImage = new Bitmap(Properties.Resources._fondo_1_1280);    
            }

            if (ancho == 1024)
            {
                this.BackgroundImage = new Bitmap(Properties.Resources._fondo_1_1280);    
            }       
        }


        private void IniciarControles()
        {
            _timer.Interval = 1000;
            _timer.Enabled = true;
            _timer.Start();
      
        }

        private void btnClienteAgregar_Click(object sender, EventArgs e)
        {
            frmClienteListado frm = new frmClienteListado();
            frm.MdiParent = this;
            frm.Show();
        }


        //detecto que tecla presiona el usuario
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
                {
            switch (keyData)
            {
                case Keys.F1:
                    frmClienteListado frm = new frmClienteListado();
                    frm.MdiParent = this;
                    frm.Show();
                    break;

                case Keys.F2:
                    MessageBox.Show("Acciones cuando se pulsa F2.");
                    break;

                case Keys.F3:
                    frmDepositoListado frmDeposito = new frmDepositoListado();
                    frmDeposito.MdiParent = this;
                    frmDeposito.Show();

                    break;

                case Keys.F4:
                    // Llamamos a otro Formulario
                    //
                   
                    break;

                case Keys.F5:
                    frmVentaRegistrar frmVenta = new frmVentaRegistrar();
                    frmVenta.MdiParent = this;
                    frmVenta.Show();

                    break;
                //default:
                //    //MessageBox.Show("Acciones cuando se pulse otras teclas.");
                //    break;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        private void btnListaCliente_Click(object sender, EventArgs e)
        {
            frmClienteListado frm = new frmClienteListado();
            frm.MdiParent = this;
            frm.Show();
        }

        private void _timer_Tick(object sender, EventArgs e)
        {
            //lblTiempo.Text = DateTime.Now.ToString();
        }

        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Test frm = new Test();
            frm.MdiParent = this;
                frm.Show();
        }

       

    }
}
